package main

/**
结构体中嵌入自己的结构体别名后，别名会以字段filedName保留在结构体变量中。
 */
import (
	"fmt"
	"reflect"
)

type Brand struct {
}

func (b Brand) Show() {
	fmt.Printf("type is %T\n", b)
}

type FakeBrand = Brand

type Vehicle struct {
	Brand
	FakeBrand
}

func main() {
	var v Vehicle
	v.FakeBrand.Show()
	//v.Brand.Show()
	v.Show()//command-line-arguments .\netedStructTypeAlias.go:29:3: ambiguous selector v.Show

	// reflect type FakedBrand
	ta := reflect.TypeOf(v)
	for i := 0; i < ta.NumField(); i++ {
		f := ta.Field(i)
		fmt.Printf("FieldName :%v,FileldType:%v\n", f.Name, f.Type.Name())
		//FieldName :Brand,FileldType:Brand
		//FieldName :FakeBrand,FileldType:Brand
	}

}
